package com.cloud.code.算法.队列.数组队列;

import com.cloud.code.算法.动态数组.Array;
import com.cloud.code.算法.队列.Queue;

public class ArrayQuque<E> implements Queue<E> {

    private Array data;

    public ArrayQuque() {
        data = new Array(10);
    }

    public ArrayQuque(int initCpacity){
        data = new Array(initCpacity);
    }

    @Override
    public int getSize() {
        return data.getSize();
    }

    @Override
    public void push(E e) {
        data.addFast(e);
    }

    @Override
    public E pop() {
        return (E) data.removeLast();
    }

    @Override
    public boolean isEmpty() {
        return data.getSize() == 0;
    }

}
